﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MinhTam.DataAccess.Web;
using MinhTam.Objects;

public partial class luubut : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            noidung.config.toolbar = HelpUtil.GetSimpleCKEditorConfig(this);
            noidung.config.uiColor = HelpUtil.GetCKEditorUiColorUser(this);
        }
    }
    protected void btnluu_Click(object sender, EventArgs e)
    {
        try
        {
            //Luu thong tin lien he
        

            string sql = @"INSERT INTO BAI_VIET(TEN_BAI_VIET,NOI_DUNG,	LOAI_BAI_VIET,	NGUOI_TAO_NAME,NGAY_TAO,NGUOI_TAO_EMAIL,NGUOI_TAO_SDT,NGUOI_TAO_DIA_CHI) 
                        VALUES( @TEN_BAI_VIET,	@NOI_DUNG,	@LOAI_BAI_VIET, @NGUOI_TAO_NAME,	getdate(),@NGUOI_TAO_EMAIL,@NGUOI_TAO_SDT,@NGUOI_TAO_DIA_CHI)";


            bool ok = SQLConnectWeb.ExecuteNonQuery(sql,
                     "@TEN_BAI_VIET", tieude.Text,
                     "@NOI_DUNG", noidung.Text.Replace("'", ""),
                     "@LOAI_BAI_VIET", HelpConstEnum.LoaiBaiViet.LUU_BUT_KHACH_HANG.GetHashCode().ToString(),
                     "@NGUOI_TAO_NAME", hovaten.Text,
                    "@NGUOI_TAO_EMAIL", email.Text,
                    "@NGUOI_TAO_SDT", sodt.Text,
                    "@NGUOI_TAO_DIA_CHI", diachi.Text
                   ) > 0;

            if (ok)
            {
                Response.Redirect("default.aspx");
            }
           
        }
        catch
        {
        }
    }
}